package org.nudt.video.service

import org.nudt.common.model.ShortVideo
import org.nudt.common.repository.ShortVideoRepository
import org.springframework.data.domain.PageRequest
import org.springframework.stereotype.Service

@Service
class ShortVideoService(private val shortVideoRepository: ShortVideoRepository) {
    
    /**
     * 获取随机排序的短视频列表
     * @param limits 限制返回的短视频数量
     * @return 短视频列表
     */
    fun shortVideoListRandom(limits: Int): List<ShortVideo> {
        return shortVideoRepository.getShortVideosOrderByRand(PageRequest.ofSize(limits))
    }
}